#ifndef DOWNLOAD_H
#define DOWNLOAD_H

#include <Wt/WContainerWidget>
#include <Wt/WString>
#include <Wt/WComboBox>
#include <Wt/WMessageBox>

#include <vector>

#include <boost/filesystem.hpp>

namespace Wt
{
class WComboBox;
class WTable;
class WText;
}

class Download : public Wt::WContainerWidget
{
	public:
		Download();

	private:

		void									comboActivated();

		void									pickedL0();
		void									pickedL1();
		void									pickedL2();
		void									pickedL3();
		void									pickedL4();
		void									pickedL5();

		void									ls(	boost::filesystem::path,
													std::pair<std::vector<boost::filesystem::path>, std::vector<boost::filesystem::path> >&);
		void									clearFutureCombos();

		void									readReleaseNotes(boost::filesystem::path, std::string& text) const;
		void									displayReleaseNotes(const std::vector<boost::filesystem::path>&);
		void									cleanReleaseNotes();

		void									downloadClicked();

		void									performDownload();

		void									messageBoxDone(Wt::StandardButton result);

		int										m_activatedLevel;

		boost::filesystem::path					m_currentPath;

		std::vector<std::string>				m_paths;

		int										m_row;
		std::vector<Wt::WComboBox*>				m_combos;
		Wt::WTable*								m_pTable;
		Wt::WText*								m_pReleaseText;
		Wt::WPushButton*						m_beginVersionSelection;
		Wt::WText*								m_pDownloadOSText;
		Wt::WPushButton*						m_downloadButton;
		boost::filesystem::path					m_fileToDownload;

		Wt::WMessageBox*						m_messageBox;
};

#endif
